package org.devgframwork.es5.elasticserach;

import io.searchbox.core.SearchResult;
import io.searchbox.core.search.aggregation.MetricAggregation;

import java.util.List;

public class EsResult<T>{

	private long total;
	private MetricAggregation metricAggregation;
	private List<T> esResultList;

	public static EsResult getEsResult(List esResultList, SearchResult searchResult) {
		EsResult esResult = new EsResult();
		esResult.setTotal(searchResult.getTotal());
		esResult.setMetricAggregation(searchResult.getAggregations());
		esResult.setEsResultList(esResultList);
		return esResult;
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public MetricAggregation getMetricAggregation() {
		return metricAggregation;
	}

	public void setMetricAggregation(MetricAggregation metricAggregation) {
		this.metricAggregation = metricAggregation;
	}

	public List<T> getEsResultList() {
		return esResultList;
	}

	public void setEsResultList(List<T> esResultList) {
		this.esResultList = esResultList;
	}
}
